/*
 * base_singleton.h
 *
 *  Created on: 2014. 3. 27.
 *      Author: wooyoung
 */

#ifndef BASE_SINGLETON_H_
#define BASE_SINGLETON_H_

#include <stdio.h>
#include <assert.h>

template <class type>
class BaseSingleton
{
public:
	BaseSingleton() {};
	virtual ~BaseSingleton() {};

	static type* getInstancePointer();
	static type& getInstance();
	static bool releaseInstance();

protected:
private:
	static type* instance_;

	BaseSingleton(BaseSingleton const& copy) {}//forbidden to use copy constructor
	BaseSingleton& operator=(BaseSingleton const& copy) { return NULL; }//forbidden to use equal operator
};

template <class type>
type* BaseSingleton<type>::instance_ = NULL;

#endif /* BASE_SINGLETON_H_ */
